﻿using MVVMOpenChildWindow.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVVMOpenChildWindow.ViewModels
{
    public class ChildWindowViewModel : INotifyPropertyChanged
    {
		private int myVar;

		public int MyProperty
		{
			get { return myVar; }
			set { myVar = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyProperty)));}
		}

        public event PropertyChangedEventHandler? PropertyChanged;

        public Command SubmitCommand { get; set; }

        public ChildWindowViewModel()
        {
            SubmitCommand = new Command(obj =>
            {
                // 发布动作
                //ActionManager.Invoke<object>("AAA", MyProperty);//一种用法

                var v = ActionManager.InvokWithParametere<object>("BBB");//第二种用法
                // 发送请求

                // 如果对委托不熟练的，可以看下Ｃ＃基础
            });
        }
    }
}
